<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //箭头函数中的this指向问题
        //箭头函数没有自己的this
        //  const calc = {
        //      add: () => {
        //          console.log(this);
        //      }
        //  }
        //  calc.add(); //window


        //练习
        const calc = {
            add: function() {
                const adder = () => {
                    console.log(this);
                }
                adder();
            }
        }

        const addFn = calc.add;
        addFn(); //undefined->window
    </script>
</body>

</html>